<template>
	<!--   -->
	<view class="jy-wrap" v-if="isLogin">
		<bnn-loading :loading="isLoading" />
		<view class="jy-topWrap">
			<view class="jy-content-t">
				<view class="content-text">
					<view class="title-gray">实盘资金<u-icon name="eye-fill"></u-icon>
					</view>
					<view class="text-number">{{contentData.balance}}</view>
				</view>
				<view class="content-text-r">
					<view class="title-gray">资金使用率</view>
					<view class="paogress_class">
						<view style="color:#FA3534 ;">{{parseIntFn(contentData.currMargin/Accountprice*100)}}%</view>
						<u-line-progress class="progress" active-color="#FF9900" :height="15" round
							:percent="(contentData.currMargin/Accountprice*100).toFixed(2)" :show-percent="false">
						</u-line-progress>
					</view>
				</view>
			</view>
			<view class="jy-content-b">
				<view class="content-l">
					<span class="title-class">总盈亏:</span>
					<span>{{parseIntFn(contentData.positionProfit+contentData.closeProfit)}}</span>
				</view>
				<view class="content-r">
					<span class="title-class">可用保证金:</span>
					<span>{{contentData.available}}</span>
				</view>
			</view>
		</view>
		<view class="jy-dataWrap">
			<view class="search-wrap">
				<view class="search_cont" @click="searchTextFn">
					<view class="">
						{{searchText}} {{chText}}
					</view>
					<u-icon name="arrow-down"></u-icon>
				</view>
				<view class="search" @click="searchFn">
					<image src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/search.png"></image>
				</view>
			</view>

			<u-popup v-model="show" mode="bottom" height="200px" :closeable="true">
				<view class="popup_tit">
					我的自选
				</view>
				<view class="content">
					<view class="cont_item" :class="index==value?'sta':''" v-for="(item,index) in myFuturesData"
						:key="index" @click="clickFutures(index,item.name)">
						{{item.name}}
					</view>
				</view>
			</u-popup>

			<view class="dataView">
				<view class="data-l">
					<view class="data-l-wrap">
						<view class="number-l">{{dealData ? dealData.last_price : '0.00'}}</view>
						<view class="number-r">
							<view v-if="dealData">
								{{dealData.last_price - dealData.pre_settlement> 0 ? '+' + (dealData.last_price - dealData.pre_settlement).toFixed(2) : (dealData.last_price - dealData.pre_settlement).toFixed(2)}}
							</view>
							<view v-else>0.00</view>
							<view v-if="dealData">{{dealData.hl}} %</view>
							<view v-else>0.00</view>
						</view>
					</view>
				</view>
				<view class="data-r">
					<view class="right-wrap">
						<view class="right-number">
							<view>卖价 <span style="color: #FA3534;margin-left: 5px;">{{dealData ? dealData.ask_price1 : '-'}}</span>
							</view>
							<view>买价 <span style="color: #FA3534;margin-left: 5px;">{{dealData ? dealData.bid_price1 : '-'}}</span>
							</view>
						</view>
						<view class="right-number">
							<view>卖量 <span style="color: #FA3534;margin-left: 5px;">{{dealData ? dealData.ask_volume1 : '-'}}</span>
							</view>
							<view>买量 <span style="color: #FA3534;margin-left: 5px;">{{dealData ? dealData.bid_volume1 : '-'}}</span>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="acount-wrap">
				<view class="zhangWrap" @click="ToTrading(1,dealData.instrument_id)">
					<view class="zhang-t">
						<image src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/shangzhang.png"></image>
						<span>买涨</span>
					</view>
					<view class="zhang-b">
						<span>后市价格上涨盈利</span>
					</view>
				</view>
				<view class="dieWrap" @click="ToTrading(2,dealData.instrument_id)">
					<view class="zhang-t">
						<image src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/shujuxiajiangqushixiadie.png"></image>
						<span>买跌</span>
					</view>
					<view class="zhang-b">
						<span>后市价格下跌盈利</span>
					</view>
				</view>
				<view class="pingWrap" @click="ToTrading(3,dealData.instrument_id)">
					<view class="zhang-t">
						<image src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/pingcang.png"></image>
						<span>平仓</span>
					</view>
					<view class="zhang-b">
						<span>先开先平</span>
					</view>
				</view>
			</view>
		</view>
		<view class="table-wrap">
			<u-tabs :list="list" inactive-color="#333" active-color="#fda600" :is-scroll="false" :current="current"
				@change="change"></u-tabs>
			<swiper :style="{height:screenHeight+'px'}" :current="swiperCurrent" @transition="transition"
				@animationfinish="animationfinish">
				<swiper-item class="swiper-item">
					<!-- 持仓 -->
					<u-table class="positoncont" border-color="#ffffff" padding="10px 0">
						<u-tr class="u-tr">
							<u-th class="u-th" width="30%">合约/方向</u-th>
							<u-th class="u-th" width="30%">可用/总仓</u-th>
							<u-th class="u-th" width="20%">成本价</u-th>
							<u-th class="u-th" width="20%">总盈亏</u-th>
						</u-tr>
						<scroll-view scroll-y="true" style="height: 400px;width: 100%;">
							<view class="Position" v-for="(item,index) in PositionData" :key="index"
								:class="statebtn==index?'checked':''">
								<view class="" @click="checkedFn(item,index)">
									<view class="tionitem">
										<view class="item1">
											<text>{{instrumentFn(item.instrumentID)}}</text>
											<text v-if="item.posiDirection==2" @click="cli1(item.instrumentID)"
												:style="{color:item.posiDirection==2?'#ff4d59':''}">涨</text>
											<text v-if="item.posiDirection==3"
												:style="{color:item.posiDirection==3?'#3dbf61':''}">跌</text>
										</view>
										<view class="item2">
											{{item.posiDirection==2?item.position-item.shortFrozen:item.position-item.longFrozen}}
											/ {{item.position}}
										</view>
										<view class="item3">{{item.costPrice ? item.costPrice : '-'}}</view>
										<view class="item4"> <text
												:style="{color:item.positionProfit>0?'#ff4d59':'#3dbf61'}">{{parseIntFn(item.positionProfit)}}</text>
										</view>
									</view>
									<view class="Positionbtn checked" v-if="statebtn==index">
										<u-button class="btnStyle" size="mini" @click="ToTrading2(item)">平仓</u-button>
										<u-button class="btnStyle1" size="mini" @click="ToTrading3(item)">止盈止损
										</u-button>
									</view>
								</view>
							</view>

							<u-empty v-if="PositionData.length==0" text="暂无持仓记录" mode="order" margin-top="20"></u-empty>
							<view class="Positionnum" v-if="PositionData.length>0">--共有 {{PositionData.length}} 条持仓记录--
							</view>
						</scroll-view>
					</u-table>
				</swiper-item>
				<swiper-item class="swiper-item">
					<!-- 委托 -->
					<u-table class="positoncont" border-color="#ffffff" padding="10px 0">
						<u-tr class="u-tr">
							<u-th class="u-th" width="25%">合约/方向</u-th>
							<u-th class="u-th" width="15%">状态</u-th>
							<u-th class="u-th" width="25%">可撤/委托</u-th>
							<u-th class="u-th" width="15%">委托价</u-th>
							<u-th class="u-th" width="20%">委托时间</u-th>
						</u-tr>
						<scroll-view scroll-y style="height: 400px;width: 100%;" @scrolltolower="onreachBottom">
							<!-- direction 1卖 0买 -->
							<!-- combOffsetFlag 1平 0跌 -->
							<!-- 卖出+平仓=卖涨，买入+平仓=卖跌 -->
							<!-- 买入+开仓= 买涨，卖出+开仓=买跌 -->
							<view class="Position" v-for="(item,index) in DeclarationData" :key="index">
								<view class="tionitem">
									<view class="Decitem1">
										<text>{{instrumentFn(item.instrumentID)}}</text>
										<view v-if="item.direction==0&&item.combOffsetFlag==0"
											:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
											买涨</view>
										<view v-else-if="item.direction==1&&item.combOffsetFlag==0"
											:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
											买跌</view>
										<view v-else-if="item.direction==1&&item.combOffsetFlag==1"
											:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
											平涨</view>
										<view v-else="item.direction==0&&item.combOffsetFlag==1"
											:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
											平跌</view>
									</view>
									<view class="Decitem2" v-if="item.stag==0" :class="item.stag==0?'stag':''"
										@click="repealFn(item,index)">可撤</view>
									<view class="Decitem2" v-else-if="item.stag==1">已成交</view>
									<view class="Decitem2" v-else="item.stag==2">已撤单</view>
									<view class="Decitem3">
										{{item.volumeTotalOriginal-item.gnum}}/{{item.volumeTotalOriginal}}
									</view>
									<view class="Decitem4">{{item.limitPrice ? parseIntFn(item.limitPrice) : '市价'}}</view>
									<view class="Decitem5">{{item.insertTime}}</view>
								</view>
							</view>
							<u-empty v-if="DeclarationData.length==0" text="暂无委托记录" mode="order" margin-top="20">
							</u-empty>
						</scroll-view>
					</u-table>
				</swiper-item>
				<swiper-item class="swiper-item">
					<!-- 条件单 -->
					<u-table class="positoncont" border-color="#ffffff" padding="10px 0">
						<view class="condition_cont">
							<!-- <view class="condition_item" :class="condistate==1?'condistate':''"
								@click="condistateFn(1)">
								未触发条件单
							</view>
							<view class="condition_item" :class="condistate==2?'condistate':''"
								@click="condistateFn(2)">
								已触发条件单
							</view> -->
							<view class="condition_item" :class="condistate==3?'condistate':''"
								@click="condistateFn(3)">
								未触发损盈单
							</view>
							<view class="condition_item" :class="condistate==4?'condistate':''"
								@click="condistateFn(4)">
								已触发损盈单
							</view>
						</view>
						<view class="condition_type">
							<scroll-view scroll-y="true" style="height: 400px;width: 100%;">
								<u-tr class="u-tr" width="100%">
									<u-th class="u-th" width="25%">合约/方向</u-th>
									<u-th class="u-th" width="10%">手数</u-th>
									<u-th class="u-th" width="40%">触发条件</u-th>
									<u-th class="u-th" width="25%">创建时间</u-th>
									<!-- <u-th class="u-th" width="20%">总盈亏</u-th> -->
								</u-tr>
								<scroll-view scroll-x="true" style="">
									<view class="type_cont">
										<!-- <view class="condi_item">合约/方向</view>
											<view class="condi_item1">手数</view>
											 <view class="condi_item2">类型</view>
											<view class="condi_item3">触发条件</view>
											<view class="condi_item4">创建时间</view> -->
									</view>
									<view class="Position" v-for="(item,index) in conditionData" :key="index"
										:class="contbtn==index?'checked':''">
										<view class="" @click="contckedFn(index)">
											<view class="tionitem">
												<view class="conditem1">
													<text>{{instrumentFn(item.instrumentID)}}</text>
													<view v-if="item.direction==0&&item.combOffsetFlag==0"
														:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
														买涨</view>
													<view v-else-if="item.direction==1&&item.combOffsetFlag==0"
														:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
														买跌</view>
													<view v-else-if="item.direction==1&&item.combOffsetFlag==1"
														:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
														平涨</view>
													<view v-else="item.direction==0&&item.combOffsetFlag==1"
														:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
														平跌</view>
												</view>
												<view class="conditem2">{{item.volumeTotalOriginal}}</view>
												<view class="conditem3">
													<!-- <text v-if="item.direction==1&&item.combOffsetFlag==1">
														{{item.contingentCondition=='E'?'止盈(最新价≤':'止损(最新价≥'}}：{{item.stopPrice}})</text>
													<text
														v-else>{{item.contingentCondition=='H'?'止盈(最新价≤':'止损(最新价≥'}}：{{item.stopPrice}})</text> -->
													<text v-if="item.direction==1&&item.combOffsetFlag==1">
														{{item.contingentCondition==8?'止盈(最新价≤':'止损(最新价≥'}}{{item.stopPrice}})</text>
													<text
														v-else>{{item.contingentCondition==6?'止盈(最新价≤':'止损(最新价≥'}}{{item.stopPrice}})</text>
													<!-- <text>止损：(最新价≤{{item.stopPrice}})</text> -->
												</view>
												<view class="conditem4">{{item.insertDate}} {{item.insertTime}}</view>
											</view>
											<view class="Positionbtn checked" v-if="contbtn==index">
												<u-button class="btnStyle2" size="mini"
													@click="Originaldelete(item,index)">删除</u-button>
												<!-- <u-button class="btnStyle1" size="mini" @click="ToTrading3(item)">止盈止损</u-button> -->
											</view>
										</view>
									</view>
								</scroll-view>
								<u-empty class="emp-hight" v-if="conditionData.length==0" text="暂无条件单记录" mode="order"
									margin-top="20"></u-empty>
								<!-- <view style="width: 100%; text-align: center; margin-top: 10px;">
									<u-button size="mini" @click="tjd()">条件单</u-button>
								</view> -->
								<view class="condition_msg">
									<view class="feng">风险提示：</view>
									<view class="text">1）多个止盈止损，先达到成先触发；</view>
									<view class="text">2）若持仓单无同方向持仓，则未触发止盈止损自动删除；</view>
									<view class="text">3）因期货交易规则，触发不保证能委托成交</view>
								</view>
							</scroll-view>
						</view>
					</u-table>
				</swiper-item>
				<swiper-item class="swiper-item">
					<!-- 已成交 -->
					<u-table class="positoncont" border-color="#ffffff" padding="10px 0">
						<u-tr class="u-tr">
							<u-th class="u-th" width="30%">合约/方向</u-th>
							<u-th class="u-th" width="25%">成交手数</u-th>
							<u-th class="u-th" width="20%">成交价</u-th>
							<u-th class="u-th" width="25%">成交时间</u-th>
						</u-tr>
						<scroll-view scroll-y="true" style="height: 400px;width: 100%;">
							<u-tr class="u-tr" v-for="(item,index) in marketionData" :key="index">
								<u-td class="u-td" width="30%">{{instrumentFn(item.instrumentID)}}
									<view v-if="item.direction==0&&item.combOffsetFlag==0"
										:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
										买涨</view>
									<view v-else-if="item.direction==1&&item.combOffsetFlag==0"
										:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
										买跌</view>
									<view v-else-if="item.direction==1&&item.combOffsetFlag==1"
										:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
										平涨</view>
									<view v-else
										:style="{color:item.direction==0&&item.combOffsetFlag==0?'#ff4d59':'#3dbf61'}">
										平跌</view>
								</u-td>
								<u-td class="u-td" width="25%">{{item.volumeTotalOriginal}}</u-td>
								<u-td class="u-td" width="20%">{{item.price ? item.price : item.limitPrice}}</u-td>
								<u-td class="u-td" width="25%">
									{{item.insertTime}}
								</u-td>
							</u-tr>
							<u-empty v-if="marketionData.length==0" text="暂无成交记录" mode="order" margin-top="20">
							</u-empty>
						</scroll-view>
					</u-table>
				</swiper-item>
			</swiper>
		</view>
		<u-popup v-model="isShow" mode="right">
			<view>
				<u-cell-group>
					<u-cell-item icon="account-fill" title="退出账户" @click="quitClick"></u-cell-item>
					<u-cell-item icon="account-fill" title="结算单" @click="affirm"></u-cell-item>
					<u-cell-item icon="account-fill" title="结算单查询" @click="affirmtime"></u-cell-item>
					<u-cell-item icon="account-fill" title="修改密码" @click="updatePassword"></u-cell-item>
					<!-- <u-cell-item icon="integral-fill" title="会员等级" value="新版本"></u-cell-item> -->
				</u-cell-group>
			</view>
		</u-popup>
		<u-popup v-model="isweituo" width="70%" mode="center" border-radius="14" :mask-close-able="false">
			<view class="entrust">
				<view class="entrust_text">交易品种：{{globalmodul.instrumentID}}</view>
				<view class="entrust_text">操作：
					<text v-if="globalmodul.direction==0&&globalmodul.combOffsetFlag==0">买涨</text>
					<text v-else-if="globalmodul.direction==1&&globalmodul.combOffsetFlag==0">买跌</text>
					<text v-else-if="globalmodul.direction==1&&globalmodul.combOffsetFlag==1">平涨</text>
					<text v-else>平跌</text>
					<!-- {{globalmodul.direction==0?'买涨':'卖跌'}} -->
					/{{globalmodul.limitPrice}}/{{globalmodul.volumeTotalOriginal}}
				</view>
				<view class="entrust_text">结果：<text class="success">委托成功</text></view>
			</view>
			<view class="entrust_btn" @click="isweituoFn">确定</view>
		</u-popup>
		<u-popup v-model="ischedan" width="70%" mode="center" border-radius="14" :mask-close-able="false">
			<view class="entrust">
				<view class="entrust_text">交易品种：{{chedanmodul.instrumentID}}</view>
				<view class="entrust_text">操作：撤单/{{chedanmodul.limitPrice}}/{{chedanmodul.volumeTotalOriginal}}手</view>
				<view class="entrust_text">结果：<text class="success">撤单成功</text></view>
			</view>
			<view class="entrust_btn" @click="ischedan=false">确定</view>
		</u-popup>
		<u-popup v-model="isjiao" width="70%" mode="center" border-radius="14" :mask-close-able="false">
			<view class="make_cont">
				<view class="make_tit">交易成交通知</view>
				<view class="make_text">{{markemodul.instrumentID}}/
					<text v-if="markemodul.direction==0&&markemodul.combOffsetFlag==0">买涨</text>
					<text v-else-if="markemodul.direction==1&&markemodul.combOffsetFlag==0">买跌</text>
					<text v-else-if="markemodul.direction==1&&markemodul.combOffsetFlag==1">平涨</text>
					<text v-else>平跌</text>
					<!-- {{markemodul.direction==0?'买涨':'买跌'}} -->
					/{{markemodul.volumeTotalOriginal}}手
				</view>
				<view class="make_text">成交价：{{markemodul.limitPrice}}</view>
				<view class="make_btn">
					<view class="bottom bgr" @click="isjiaoFn">取消</view>
					<view class="bottom bgy" @click="isjiaoFn">查看</view>
				</view>
			</view>
		</u-popup>
	</view>
	<view v-else class="noLoginWrap">
		<view class="title-t">
			搜量量化
		</view>
		<u-grid :col="3" :border="false">
			<u-grid-item>
				<u-image width="80rpx" height="80rpx" src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/jisu.png"></u-image>
				<view class="grid-text">极速行情</view>
			</u-grid-item>
			<u-grid-item>
				<u-image width="80rpx" height="80rpx" src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/shandian.png"></u-image>
				<view class="grid-text">闪电下单</view>
			</u-grid-item>
			<u-grid-item>
				<u-image width="80rpx" height="80rpx" src="https://sou-liang.oss-cn-shanghai.aliyuncs.com/weixin/images/caozuo.png"></u-image>
				<view class="grid-text">操作简单</view>
			</u-grid-item>
		</u-grid>
		<u-button type="primary" @click="ToLogin">立即开户</u-button>
		<u-button @click="deallogin">已有账号，马上添加</u-button>
		<view class="no-bottom">开户由期货保证金监控中心提供</view>
	</view>
</template>

<script>
	import BnnLoading from '@/components/bnn-ui/loading/index.vue'
	import contractJson from '@/static/json/contract_file.json'
	// import {affirmJieSuan} from '@/api/strategy.js'
	import {
		formatMoney
	} from '@/utils/index.js'
	import {
		instrumentName
	} from '@/api/rank.js'
	const dcRichAlert = uni.requireNativePlugin('Trader')
	var globalEvent = uni.requireNativePlugin('globalEvent');
	var globalstr = ''
	var globalData = [] //委托单
	var markeData = [] //成交单
	var condData = [] //条件单
	var condData4 = []
	var Orderjiao = false
	var Orderweituo = false
	var global = ''
	var marke = ''
	var weitimer = null
	let num = 1
	var cenum = -1
	var userid = ''
	var markeid = ''
	var bloAccountId = ''
	var condAccount = ''
	var overcondAccount = ''

	const fnTimeSet = function () {
		let date = new Date()
		let year = date.getFullYear()
		let month = date.getMonth() + 1
		if (month < 10) month = '0' + month
		let day = date.getDate()
		let getDate = year.toString() + month.toString() + day.toString()
		uni.setStorageSync('globalTime', getDate);
	}

	const usertion = uni.getStorageSync('userPosition')
	if (usertion) {
		userid = usertion.user + 'userid'
		markeid = usertion.user + 'markeid'
		bloAccountId = usertion.user + 'bloAccountid'
		condAccount = usertion.user + 'condAccount'
		overcondAccount = usertion.user + 'overcondAccount'
	}
	globalEvent.addEventListener('onRtnOrder', function(e) { //报单监听  条件单监听  撤单监听
		const usertion = uni.getStorageSync('userPosition')
		if (usertion) {
			userid = usertion.user + 'userid'
			markeid = usertion.user + 'markeid'
			bloAccountId = usertion.user + 'bloAccountid'
			condAccount = usertion.user + 'condAccount'
			overcondAccount = usertion.user + 'overcondAccount'
		}
		// e.orderStatus
		// 0: 全部成交-已全部成交
		// 1: 部分成交还在队列-部分成交，剩余部分在等待成交
		// 2: 部分成交不在队列-部分成交，剩余部分已撤单
		// 3: 委托(未成交还在队列中-报单已发往交易所正在等待成交)
		// 4: 委托(未成交不在队列中-报单还未发往交易所)
		// 5: 撤单(已全部撤单)
		// a: 未知
		// b: 条件单 (尚未触发-预埋单等尚未达到触发下单条件，客户端还未执行下单动作)
		// c: 条件单 (已触发-预埋单等已达触发下单条件，客户端执行下单操作)
		if (!isNaN(e.orderStatus)) {
			e.stag = 0
			if (e.orderStatus == '0') {
				e.stag = 1
				
				// 存入成交
				markeData.unshift(e)
				Orderjiao = true
				marke = e
				try {
					const mAccount = uni.getStorageSync(markeid)
					if (mAccount) {
						let newArr = mAccount
						let status = true
						let eidx = 0
						let maxStr = new Date().getTime()
						newArr.map((entrust, index) => {
							let timeStr = new Date(e.InsertDate+e.InsertTime).getTime()
							let _timeStr = new Date(entrust.InsertDate+entrust.InsertTime).getTime()
							if (_timeStr > timeStr) {
								status = false
								if (maxStr > _timeStr) {
									maxStr = _timeStr
									eidx = index
								}
							}
						})
						if (status) {
							newArr.unshift(e)
						} else {
							newArr.splice(eidx+1, 0, e)
						}
						uni.setStorageSync(markeid, newArr);
					} else {
						uni.setStorageSync(markeid, markeData);
					}
					const bloAccount = uni.getStorageSync(bloAccountId)
					if (bloAccount) {
						bloAccount.unshift(e)
						uni.setStorageSync(bloAccountId, bloAccount);
					} else {
						globalData.unshift(e)
						uni.setStorageSync(bloAccountId, globalData);
					}
					fnTimeSet()
				} catch (e) {
				// 成交
				}
			}
			if (e.orderStatus == '2' || e.orderStatus == '5') {
				e.stag = 2
			}
			
			// 存入委托
			e.gnum = 0
			globalstr = e
			Orderweituo = true
			global = e
			try {
				const gAccount = uni.getStorageSync(userid)
				if (gAccount) {
					const newArr = gAccount
					let status = true
					let eidx = 0
					let maxStr = new Date().getTime()
					newArr.map((entrust, index) => {
						let timeStr = new Date(e.InsertDate+e.InsertTime).getTime()
						let _timeStr = new Date(entrust.InsertDate+entrust.InsertTime).getTime()
						if (_timeStr > timeStr) {
							status = false
							if (maxStr > _timeStr) {
								maxStr = _timeStr
								eidx = index
							}
						}
					})
					if (status) {
						newArr.unshift(e)
					} else {
						newArr.splice(eidx+1, 0, e)
					}
					uni.setStorageSync(userid, newArr);
				} else {
					globalData.unshift(e)
					uni.setStorageSync(userid, globalData);
				}
				fnTimeSet()
			} catch (e) {
				// 委托error
			}
		} else {
			switch(e.orderStatus) {
				case 'a':
					uni.showToast({
						title: e.statusMsg,
						icon: 'none'
					})
					break;
				case 'b':
					condData.unshift(e)
					try {
						const cAccount = uni.getStorageSync(condAccount)
						if (cAccount) {
							cAccount.unshift(e)
							uni.setStorageSync(condAccount, cAccount);
						} else {
							uni.setStorageSync(condAccount, condData);
						}
					} catch (e) {
						// 未触发条件单
					}
					break;
				case 'c':
					condData4.unshift(e)
					try {
						const overAccount = uni.getStorageSync(overcondAccount)
						if (overAccount) {
							overAccount.unshift(e)
							uni.setStorageSync(overcondAccount, overAccount);
						} else {
							uni.setStorageSync(overcondAccount, condData4);
						}
					} catch (e) {
						// 已触发条件单
					}
					break;
			}
			fnTimeSet()
		}
	});
	globalEvent.addEventListener('onRtnTrade', function(e) { // 监听成交
		let mvalue = uni.getStorageSync(markeid); 
		mvalue.map(item=> {
			if (item.orderLocalID == e.orderLocalID
				&& item.direction == e.direction
				&& item.instrumentID == e.instrumentID) {
				item.price = Number(e.price).toFixed(2)
				if (e.TradeTime) {
					item.insertTime = e.TradeTime
				}
			}
			return item
		})
		uni.setStorageSync(markeid, mvalue);
	})
	export default {
		components: {
			BnnLoading
		},
		data() {
			return {
				condistate: 3,
				Accountprice: '',
				statebtn: -1,
				contbtn: -1,
				isweituo: false,
				isjiao: false,
				ischedan: false,
				searchText: '螺纹钢2105 rb2105',
				chText: '',
				screenHeight: 450,
				show: false,

				isLogin: false, //控制页面登录是否
				isLoading: true, //是否加载

				// isLogin: true,
				// isLoading: false,

				value: 0,
				list: [{
					name: '持仓',
					value: 0
				}, {
					name: '委托',
					value: 1
				}, {
					name: '条件单',
					value: 2
				}, {
					name: '成交',
					value: 3
				}],
				current: 0,
				swiperCurrent: 0,
				contentData: [],
				myFuturesData: [], //自选
				dealData: null,
				dealTime: null,
				tradingAccount: null,
				storPosition: null,
				isShow: false,
				PositionData: [], //持仓
				DeclarationData: [ //委托
					// {instrumentID:'J1212',direction:1,combOffsetFlag:1,stag:1,gnum:1,volumeTotalOriginal:5,limitPrice:22132,insertTime:12232}
				],
				marketionData: [], //成交
				conditionData: [ //条件单
					// {instrumentID:'YU1212',direction:0,contingentCondition:'9',combOffsetFlag:0,stag:1,gnum:1,volumeTotalOriginal:2,stopPrice:275,insertDate:19980326,insertTime:'10:12:12'},
				],
				globalmodul: '',
				markemodul: '',
				chedanmodul: '',
				instrumentName: {},
				triggerdata: [], // 未触发条件单
				triggerdata1: [], // 已触发条件单
				triggerdata2: [], // 未触发损盈单
				triggerdata3: [], // 已触发损盈单
				TradingId:''
			}
		},
		onNavigationBarButtonTap: function(e) {
			// getApp().globalData.isAccount=false
			if (this.isLogin) this.isShow = true;
			else uni.showToast({
				title: '请先登录账户',
				icon: 'none'
			});
		},
		onShow() {
			let webView = this.$mp.page.$getAppWebview();
			if (getApp().globalData.isAccount) { //是否登录账户
				const usertion = uni.getStorageSync('userPosition')
				if (usertion) {
					userid = usertion.user + 'userid'
					markeid = usertion.user + 'markeid'
					bloAccountId = usertion.user + 'bloAccountid'
					condAccount = usertion.user + 'condAccount'
					overcondAccount = usertion.user + 'overcondAccount'
				}
				this.isLogin = true
				if (this.contentData == '') {
					this.isLoading = true
				}
				let that = this
				webView.setTitleNViewButtonStyle(0, {
					width: '30',
				})

				this.isjiao = Orderjiao
				this.isweituo = Orderweituo

				this.globalmodul = global
				this.markemodul = marke
				this.reqTradingAccount()
				this.isLoading = false
				this.recordRender()
				this.condRender()
				let marketID = getApp().globalData.marketID
				let rankDetail = getApp().globalData.rankDetail
				let TradingId= getApp().globalData.TradingId
				if (rankDetail) { //是否有搜索记录
					const { instrument_id, name } = rankDetail
					getApp().globalData.marketID = instrument_id
					getApp().globalData.TradingId = instrument_id
					getApp().globalData.searchText = name
					getApp().globalData.chText = instrument_id.split('.')[1]
					this.searchText = name
					this.chText = instrument_id.split('.')[1]
					this.dealdata(instrument_id)
					this.statebtn = -1
					getApp().globalData.rankDetail = null
				} else if (TradingId) {
					this.dealdata(TradingId)
				} else if (marketID) {
					this.dealdata(marketID)
					this.statebtn = -1
				} else {
					this.myFutures(0)
					this.statebtn = -1
					return
				}
				this.myFutures()
			} else {
				this.isLoading = false
				this.isLogin = false
				webView.setTitleNViewButtonStyle(0, {
					width: '0',
				});
			}
		},
		onLoad() {
			instrumentName().then(res => { //获取合约中文名
				this.instrumentName = res.data
			})
		},
		mounted() {

		},
		onHide() {
			if (this.dealTime) {
				clearInterval(this.dealTime)
				this.dealTime = null
			}
			if (this.storPosition) {
				clearInterval(this.storPosition)
				this.storPosition = null
			}
		},
		destroyed() {
			if (this.dealTime) {
				clearInterval(this.dealTime)
				this.dealTime = null
			}
			if (this.storPosition) {
				clearInterval(this.storPosition)
				this.storPosition = null
			}
		},
		methods: {
			recordRender() {
				try { //获取委托信息
					let user_id = ''
					let markeid = ''
					const usertion = uni.getStorageSync('userPosition')
					if (usertion) {
						user_id = usertion.user + 'userid'
						markeid = usertion.user + 'markeid'
					}
					let value = uni.getStorageSync(user_id); //委托
					let mvalue = uni.getStorageSync(markeid); //成交
					if (mvalue) {
						this.marketionData = mvalue 
					}
					if (value) {
						let arrValue = value
						let arrmark = mvalue
						try {
							for (let i = 0; i < arrValue.length; i++) {
								for (let j = i + 1; j < arrValue.length; j++) {
									if (arrValue[i].orderLocalID == arrValue[j].orderLocalID) {
										arrValue.splice(j, 1)
										j--;
									}
								}
							}
						} catch (e) {
							// 循环报错
						}
				
						if (mvalue) {
							//状态获取
							for (let y = 0; y < arrValue.length; y++) {
								for (let r = 0; r < arrmark.length; r++) {
									if (arrmark[r].instrumentID == arrValue[y].instrumentID && arrmark[r].direction ==
										arrValue[y].direction && arrmark[r].combOffsetFlag == arrValue[y]
										.combOffsetFlag &&
										arrmark[r].orderLocalID == arrValue[y].orderLocalID) {
										// if(arrmark[r].orderLocalID==arrValue[y].orderLocalID){
										arrValue[y].stag = 1
										arrValue[y].gnum = arrmark[r].volumeTotalOriginal
									} else {
										if (arrValue[y].stag == 2) {
											arrValue[y].stag = 2
											arrValue[y].gnum = 1
										} else {
											if (arrValue[y].stag == 1) {
				
											} else {
												arrValue[y].stag = 0
												arrValue[y].gnum = 0
											}
										}
									}
				
								}
							}
							this.DeclarationData = arrValue
						} else {
							this.DeclarationData = arrValue
						}
					}
				} catch (e) {
					// 委托error
				}
			},
			condRender() {
				try { //条件单
					const usertion = uni.getStorageSync('userPosition')
					if (usertion) {
						condAccount = usertion.user + 'condAccount'
						overcondAccount = usertion.user + 'overcondAccount'
					}
					let arrcondvalue = uni.getStorageSync(condAccount); //未触发
					if (arrcondvalue) {
						this.triggerdata2 = arrcondvalue
					}
					let arrovervalue = uni.getStorageSync(overcondAccount); //已触发
					if (arrovervalue) {
						this.triggerdata3 = arrovervalue
					}
					if (arrovervalue) { //去掉已触发盈损
						arrcondvalue.map((cond, index) => {
							arrovervalue.map(over => {
								if (cond.orderLocalID == over.orderLocalID || cond.orderSysID == over.orderSysID) {
									arrcondvalue.splice(index, 1)
								}
							})
						})
						this.triggerdata2 = arrcondvalue
						uni.setStorageSync(condAccount, arrcondvalue);
					}
					if (this.condistate == 1) {
						this.conditionData = this.triggerdata
					} else if (this.condistate == 2) {
						this.conditionData = this.triggerdata1
					} else if (this.condistate == 3) {
						this.conditionData = this.triggerdata2
					} else {
						this.conditionData = this.triggerdata3
					}
				} catch (e) {
					// 条件单error
				}
			},
			tjd() {
				let TradingId = getApp().globalData.TradingId
				uni.navigateTo({
					url: 'conditionsOfsingle/index?index=' + 1 + '&id=' + TradingId
				})
			},
			updatePassword() {
				uni.navigateTo({
					url: '../../user/updatePassword/index'
				})
			},
			ToTrading(index, id) {
				let TradingId = getApp().globalData.TradingId
				if(TradingId == ''){
					this.TradingId = id
				}
				if(TradingId != ''){
					this.TradingId = getApp().globalData.TradingId
				}
				uni.navigateTo({
					url: './trading/index?index=' + index + '&id=' + this.TradingId
				})
			},
			checkedFn(item, i) {
				if (this.statebtn == i) {
					this.statebtn = -1
				} else {
					this.statebtn = i
					if (this.dealTime) {
						clearInterval(this.dealTime)
						this.dealTime = null
					}
					this.searchText = this.instrumentName[item.instrumentID]
					this.chText = item.instrumentID
					let id = item.exchangeID + '.' + item.instrumentID
					getApp().globalData.TradingId = id
					let appid = getApp().globalData.TradingId
					this.dealdata(id)
				}
			},
			dealdata(n) { // 持续更新行情
				let that = this;
				that.reqNewData(n)
				that.dealTime = setInterval(() => {
					that.reqNewData(n)
				}, 1000)
			},
			reqNewData(n) { //获取行情
				uni.request({
					url: 'https://md.sou-liang.com/api/newData',
					data: {
						name: n
					},
					success: (res) => {
						this.dealData = res.data
					}
				})
			},
			myFutures(inment) { //获取自选
				let {
					id
				} = uni.getStorageSync('MEMBER_INFO')
				uni.request({
					url: 'https://md.sou-liang.com/api/myFutures',
					data: {
						 id: id
					},
					success: (res) => {
						this.myFuturesData = res.data
						if (getApp().globalData.searchText == '') {
							if (inment) {
								this.searchText = inment.name
								let {
									instrument_id
								} = inment
								let text = inment.instrument_id.split('.')
								this.chText = text[1]
								this.dealdata(instrument_id)
							} else if (inment == 0) {
								this.searchText = res.data[0].name
								let {
									instrument_id
								} = res.data[0]
								let text = res.data[0].instrument_id.split('.')
								this.chText = text[1]
								this.dealdata(instrument_id)
							}
						}
					}
				})
			},
			clickFutures(i, name) { //点击改变自选
			    getApp().globalData.TradingId = ''
				getApp().globalData.searchText = name
				let searchTextName = getApp().globalData.searchText
				this.searchText = searchTextName
				this.value = i
				let {
					instrument_id
				} = this.myFuturesData[i]
				let text = instrument_id.split('.')
				getApp().globalData.chText = text[1]
				let globaText = getApp().globalData.chText
				this.chText = globaText
				clearInterval(this.dealTime)
				this.dealTime = null
				getApp().globalData.marketID = instrument_id
				let getInstrument_id = getApp().globalData.marketID
				this.dealdata(getInstrument_id)
				this.show = false
				this.statebtn = -1
			},
			change(index) {
				this.current = index;
				this.swiperCurrent = index;
				this.recordRender()
				this.condistateFn(3)
			},
			instrumentFn(text) { //合约名转汉字
				let arr = this.instrumentName[text];
				if (arr) {
					return arr
				} else {
					return text
				}
			},
			parseIntFn(num) { //保留两位
				if (num) {
					return num.toFixed(2)
				} else {
					return num
				}
			},
			condistateFn(index) {
				this.condistate = index
				this.condRender()
			},
			setSwiperHeight() {
				// this.$nextTick(()=>{
				let query = uni.createSelectorQuery().in(this);
				query.selectAll(".u-table").boundingClientRect();
				query.exec((res) => {
					this.screenHeight = res[0][this.current].height;
				})
				// }
			},
			isweituoFn() {
				this.isweituo = false
				Orderweituo = false
				// Vue.prototype.$isweituo = false
			},
			isjiaoFn() {
				this.isjiao = false
				Orderjiao = false
				// Vue.prototype.$isjiao = false
			},
			contckedFn(i) {
				if (this.contbtn == i) {
					this.contbtn = -1
				} else {
					this.contbtn = i
				}
			},
			affirmtime() { //是否确认结算单
				this.isShow = false
				uni.navigateTo({
					url: '/pages/tabBar/transaction/stetementime/index'
				})
			},
			affirm() {
				this.isShow = false
				uni.navigateTo({
					url: './statement/index'
				})
			},
			reqTradingAccount() { //获取账户信息
				let that = this
				dcRichAlert.reqQrySecAgentTradingAccount({}, function(res) {
					if (that.contentData == '') {}
					if (res.code == 200) {
						if (res.data instanceof Object) {
							getApp().globalData.available = res.data.available
							that.Accountprice = res.data.balance
							res.data.balance = formatMoney(res.data.balance)
							res.data.available = formatMoney(res.data.available)
							that.contentData = res.data
							that.reqInvestorPosition(res.data)
							that.getRecordTimer(res.data)
						}
					}
				})
			},
			getRecordTimer(item) { //计时器查询开仓信息
				let thet = this
				thet.storPosition = setInterval(() => {
					thet.reqInvestorPosition(item)
				}, 2000)
			},
			reqInvestorPosition(item) { //查询持仓记录
				let thet = this
				dcRichAlert.reqQryInvestorPosition({}, function(res) {
					if (Array.isArray(res.data)) {
						let bdata = res.data.map(count => count).filter(_item => {
							return !isNaN(_item.position) && _item.position != 0
						})
						let pdata = []
						// 合并持仓同合约同类型数据
						bdata.map(bitem => {
							if (pdata.length > 0) {
								let status = true
								pdata.map((pitem, index) => {
									if (bitem.direction == pitem.direction &&
										bitem.instrumentID == pitem.instrumentID &&
										bitem.posiDirection == pitem.posiDirection) {
										pdata[index].position += bitem.position
										pdata[index].openCost += bitem.openCost
										pdata[index].positionProfit += bitem.positionProfit
										pdata[index].ByTrade += bitem.ByTrade
										if (pitem.posiDirection == 2) {
											pdata[index].shortFrozen += bitem.shortFrozen
										} else {
											pdata[index].longFrozen += bitem.longFrozen
										}
										status = false
									}
								})
								if (status) {
									pdata.push(bitem)
								}
							} else {
								pdata.push(bitem)
							}
						})
						let data = {
							BrokerID:  item.brokerID,
							InvestorID: item.investorID,
							ExchangeID: item.exchangeID,
							InvestUnitID: item.investUnitID
						}
						try {
							// 获取持仓详情
							dcRichAlert.reqQryInvestorPositionDetail(data, function(ret) {
								if (Array.isArray(ret.data)) {
									let Ddata = ret.data
									let pnum = pdata.length
									let dnum = Ddata.length
									if (dnum > 0) {
										for (let i = 0; i < pnum; i++) {
											pdata[i]['ageprice'] = 0
											pdata[i]['agenum'] = 0
											for (let j = 0; j < dnum; j++) {
												if (Ddata[j].hasOwnProperty('direction') &&
													Ddata[j].hasOwnProperty('openPrice') &&
													Ddata[j].hasOwnProperty('positionProfitByTrade')) {
													if (pdata[i].posiDirection == 3 && pdata[i]
														.instrumentID == Ddata[j]
														.instrumentID && Ddata[j]
														.direction == Ddata[j].hedgeFlag) {
														pdata[i].ageprice += Ddata[j].openPrice
														pdata[i].agenum += 1
														pdata[i].positionProfit += Ddata[j]
															.positionProfitByTrade
													}
													if (pdata[i].posiDirection == 2 && pdata[i]
														.instrumentID == Ddata[j]
														.instrumentID && Ddata[j]
														.direction != Ddata[j].hedgeFlag) {
														pdata[i].ageprice += Ddata[j].openPrice
														pdata[i].agenum += 1
														pdata[i].positionProfit += Ddata[j]
															.positionProfitByTrade
													}
												}
											}
											pdata[i]['costPrice'] = thet.parseIntFn(pdata[i].ageprice/pdata[i].agenum)
										}
									}
								}
							})
						} catch (e) {
							// error
						} finally {
							setTimeout(() => {
								if (pdata.length > 0 && !pdata[0].costPrice) {
									//获取详情失败，通过计算获取相关数据
									pdata.map(count => {
										if (count.openCost && count.position) {
											let str = count.instrumentID.replace(/[^a-zA-Z]+/g,"");
											let contractList = contractJson.data
											contractList.map(contract => {
												let _contract = JSON.parse(JSON.stringify(contract))
												if (_contract.nameCode === str) {
													count.contract = _contract.value
													count.costPrice = (Number(count.openCost.toFixed(2))/count.position/_contract.value).toFixed(2)
												}
											})
										}
										return count
									})
								}
								thet.PositionData = pdata
								uni.setStorageSync('reqQryposition', pdata);
							}, 1000)
						}
						//持仓多空方向 PosiDirection 2涨  3跌
						//投机套保标志 hedgeFlag
						//买卖 direction 
						// 	// uni.setStorageSync('InvestorPosition', res.data);
					}
				})
			},
			//撤单
			repealFn(item, index) {
				let thst = this
				let data = {
					ActionFlag: '0', //操作标志
					BrokerID: item.brokerID, //经纪公司代码
					InvestorID: item.investorID, //
					ExchangeID: item.exchangeID, ///交易所代码
					InstrumentID: item.instrumentID, ///合约代码
					UserID: item.userID, ///用户代码
					OrderSysID: item.orderSysID, ///报单编号
					SessionID: item.sessionID, ///会话编号
					OrderRef: item.orderRef, ///报单引用
					FrontID: item.frontID, ///前置编号
					// LimitPrice:item.limitPrice,//
					// VolumeChange:item.volumeTotalOriginal,
					// nRequestID:'1'
				}
				// globalEvent.removeEventListener('onRtnOrder', function(e) {})
				try {
					let action = 0
					dcRichAlert.reqOrderAction(data, function(res) {
						action = 1
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
						if (res.code == 26) {
							item.stag = 2
							// thst.DeclarationData.push(item)
							thst.DeclarationData[index] = item
							// cenum=index
							// thst.chedanmodul=res.data
							// thst.ischedan=true
							let tdata = thst.DeclarationData
							try {
								uni.setStorageSync('globalAccount', tdata);
							} catch (e) {
								// 撤单报错
							}
						}
					})
					setTimeout(() => {
						if (action == 0) {
							item.stag = 2
							// thst.DeclarationData.push(item)
							thst.DeclarationData[index] = item
							let rdata = thst.DeclarationData
							// cenum=index
							try {
								uni.setStorageSync('globalAccount', rdata);
							} catch (e) {
								// 撤单报错
							}
						}
					}, 1000)
				} catch (e) {
					// 撤单报错
				}
			},
			Originaldelete(item, index) { //删除条件单

				let deletedata = {
					ActionFlag: '0', //操作标志
					BrokerID: item.brokerID, //经纪公司代码
					InvestorID: item.investorID, //
					ExchangeID: item.exchangeID, ///交易所代码
					InstrumentID: item.instrumentID, ///合约代码
					UserID: item.userID, ///用户代码
					OrderSysID: item.orderSysID, ///报单编号
					SessionID: item.sessionID, ///会话编号
					OrderRef: item.orderRef, ///报单引用
					FrontID: item.frontID, ///前置编号
				}
				try {
					dcRichAlert.reqOrderAction(deletedata, function(res) {
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
						if (res.code == 26) {

						}
					})
					setTimeout(() => {
						this.conditionData.splice(index, 1)
						uni.showToast({
							title: '删除成功',
							icon: 'none'
						})
						uni.setStorageSync(condAccount, this.conditionData);
					}, 1000)
				} catch (e) {
					// 撤单报错
				}
			},
			quitClick() { //退出账户
				let that = this
				uni.showLoading({
					title: '退出中'
				});
				// uni.removeStorageSync('TradingAccount');

				if (this.dealTime) {
					clearInterval(this.dealTime)
					this.dealTime = null
				}
				// if (this.tradingAccount) {
				// 	clearInterval(this.tradingAccount)
				// 	this.tradingAccount = null
				// }
				if (this.storPosition) {
					clearInterval(this.storPosition)
					this.storPosition = null
				}
				let rdata = {
					BrokerID: this.contentData.brokerID,
					UserID: this.contentData.accountID
				}
				try {
					dcRichAlert.reqUserLogout(rdata, function(res) {
						uni.hideLoading();
						globalData = [] //委托单
						markeData = [] //成交单
						condData = [] //条件单
						condData4 = []
						that.PositionData = []
						that.contentData = []
						that.conditionData = []
						that.DeclarationData = []
						that.marketionData = []
						that.triggerdata = []
						that.triggerdata1 = []
						that.triggerdata2 = []
						that.triggerdata3 = []
						that.isShow = false
						that.isLogin = false
						getApp().globalData.isAccount = false
						that.current = 0;
						that.swiperCurrent = 0;
						uni.removeStorageSync('globalAccount')
						uni.removeStorageSync('markeAccount')
					})
				} catch (err) {
					uni.hideLoading();
					setTimeout(() => {
						uni.showToast({
							title: '网络错误，请稍后再试',
							icon: 'none'
						})
					})
				}
			},
			searchFn() {
				uni.navigateTo({
					url: '../rank/ranksearch/ranksearch?index=1'
				})
			},
			searchTextFn() {
				this.show = true
			},
			closeDropdown() {
				this.$refs.uDropdown.close();
			},
			// swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
				// let dx = e.detail.dx;
				// this.$refs.uTabs.setDx(dx);
			},
			// 由于swiper的内部机制问题，快速切换swiper不会触发dx的连续变化，需要在结束时重置状态
			// swiper滑动结束，分别设置tabs和swiper的状态
			animationfinish(e) {
				let current = e.detail.current;
				// this.$refs.uTabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
			// scroll-view到底部加载更多
			onreachBottom() {

			},
			ToTrading2(item) { //去平仓
				let id = item.exchangeID + '.' + item.instrumentID
				let type = 0
				let prise = item.positionProfit / item.position
				if (item.posiDirection == 2) {
					type = 0 //涨
				} else {
					type = 1 //跌
				}
				uni.navigateTo({
					url: './trading/index?index=3&id=' + id + '&type=' + type + '&prise=' + prise
				})
			},
			ToTrading3(item) { //止盈止损
				let id = item.exchangeID + '.' + item.instrumentID
				let type = 0
				let prise = item.positionProfit / item.position
				if (item.posiDirection == 2) {
					type = 0 //涨
				} else {
					type = 1 //跌
				}
				uni.navigateTo({
					url: './trading/index?index=3&loss=1&id=' + id + '&type=' + type + '&prise=' + prise
				})
			},
			ToLogin() {
				const user = uni.getStorageSync('MEMBER_INFO')
				if (user) uni.navigateTo({
					url: '/pages/account/open/index'
				});
				else uni.navigateTo({
					url: '/pages/user/login/index?user=1'
				});
			},
			deallogin() {
				const user = uni.getStorageSync('MEMBER_INFO')
				if (user) uni.navigateTo({
					url: '/pages/user/dealLogin/dealLogin'
				});
				else uni.navigateTo({
					url: '/pages/user/login/index?user=1'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.emp-hight {
		height: 100px;
	}

	.type_cont {
		padding: 10px 15px;
		display: flex;

		.condi_item {
			width: 80px;
			text-align: center;
		}

		.condi_item1 {
			width: 60px;
			text-align: center;
		}

		.condi_item2 {
			width: 80px;
			text-align: center;
		}

		.condi_item3 {
			width: 120px;
			text-align: center;
		}

		.condi_item4 {
			width: 120px;
			text-align: center;
		}
	}

	.condition_msg {
		padding: 15px 5px;

		.feng {
			color: #ff4d59;
			font-size: 13px;
		}

		.text {
			font-size: 12px;
			color: #928f8f;
		}
	}

	.condition_cont {
		width: 100%;
		display: flex;
		justify-content: space-around;
		align-items: center;
		padding: 5px;
		background-color: #fff;
		border-top: 1px solid #f9f9f9;

		.condition_item {
			width: 50px;
			// height: 45px;
			font-size: 13px;
			// line-height: 45px;
			text-align: center;
			padding: 2px;
		}

		.condistate {
			border: 1px solid #EFAB00;
			color: #EFAB00;
			border-radius: 5px;
			// background-color: ;
		}
	}

	.u-tr {
		border-bottom: 1px solid #f9f9f9;
	}

	.Position {
		border-bottom: 1px solid #f9f9f9;

		// padding: 5px;
		.tionitem {
			display: flex;
			align-items: center;
			text-align: center;
			padding: 10px 0;

			.item1 {
				width: 30%;
				display: flex;
				flex-direction: column;
			}

			.item2 {
				width: 30%;
			}

			.item3 {
				width: 20%;
			}

			.item4 {
				width: 20%;
			}

			.Decitem1 {
				width: 25%;
				display: flex;
				flex-direction: column;
			}

			.Decitem2 {
				width: 15%;
			}

			.stag {
				border: 1px solid #d3d6d6;
				border-radius: 5px;
				padding: 2px 0;
			}

			.Decitem3 {
				width: 25%;
			}

			.Decitem4 {
				width: 15%;
			}

			.Decitem5 {
				width: 20%;
			}

			.conditem1 {
				width: 25%;
			}

			.conditem2 {
				width: 10%;
			}

			.conditem3 {
				width: 40%;
				display: flex;
				flex-wrap: nowrap;
				flex-direction: column;
			}

			.conditem4 {
				width: 25%;
			}

		}
	}

	.Positionbtn {
		color: #EFAB00;
		text-align: center;
		// display: flex;
		// justify-content: center;
		margin-bottom: 5px;
		padding: 0 0 5px;
	}

	.checked {
		background-color: #fdfcf7;
	}

	.btnStyle {
		color: #EFAB00;
		border-color: #c0c4cc;
	}

	.btnStyle1 {
		color: #EFAB00;
		border-color: #c0c4cc;
		margin-left: 15px;
	}

	.make_cont {
		padding: 10px;

		.make_tit {
			font-size: 18px;
			font-weight: bold;
			text-align: center;
			margin: 5px 0 10px;
		}

		.make_text {
			line-height: 30px;
		}

		.make_btn {
			display: flex;
			justify-content: space-between;
			text-align: center;
			margin-top: 10px;
			font-size: 16px;

			.bottom {
				width: 48%;
				height: 40px;
				line-height: 40px;
				color: #fff;
				text-align: center;
				border-radius: 10px;
			}

			.bgr {
				background-color: #d3d6d6;
			}

			.bgy {
				background-color: #EFAB00;
			}
		}
	}

	.entrust {
		padding: 10px 15px;
		font-size: 16px;

		.entrust_text {
			line-height: 25px;

			.success {
				color: #EFAB00;
			}
		}
	}

	.entrust_btn {
		width: 100%;
		height: 44px;
		line-height: 44px;
		text-align: center;
		color: #EFAB00;
		font-size: 16px;
		border-top: 1rpx solid #676666;
	}

	.popup_tit {
		width: 100%;
		text-align: center;
		font-size: 16px;
		padding: 10px 0;
	}

	.Positionnum {
		margin-top: 10px;
		font-size: 12px;
		text-align: center;
		color: #e9e9e9;
	}

	.content {
		padding: 24rpx;

		// text-align: center;
		// display: flex;
		// flex-wrap:wrap;
		// justify-content: space-around;
		// align-items:flex-start;
		// align-content: flex-start;
		.cont_item {
			// flex: 0.33;
			width: 30%;
			height: 60rpx;
			display: inline-block;
			line-height: 60rpx;
			text-align: center;
			margin-left: 2%;
			margin-top: 5px;
			border: 1px solid #E8E8E8;
			border-radius: 20rpx;
		}

		.sta {
			border: 1px solid #FDA600;
			color: #FDA600;
		}
	}

	.jy-wrap {
		width: 100%;
		// height: 100vh;
		min-height: 100%;
		background-color: $uni-bg-color-grey;

		.jy-topWrap {
			width: 90%;
			margin-left: 5%;
			background-color: $uni-bg-color;
			height: 230rpx;
			border-radius: 10rpx;
			box-shadow: 0 0 9px 3px #F2F2F2;
			margin-top: 10rpx;

			.jy-content-t {
				width: 90%;
				margin-left: 5%;
				height: 150rpx;
				border-bottom: 1px solid $uni-border-color;
				display: flex;
				padding-top: 20rpx;

				.content-text {
					flex: 1;

					.title-gray {
						color: $uni-text-color-grey;
						font-size: $uni-font-size-lg;
					}

					.text-number {
						color: $uni-text-color;
						font-size: $uni-font-size-lg;
						margin-top: 20rpx;
						font-weight: 600;
					}
				}

				.content-text-r {
					flex: 1;
					text-align: right;

					.paogress_class {
						.progress {
							width: 200rpx;
						}
					}
				}
			}

			.jy-content-b {
				width: 90%;
				margin-left: 5%;
				height: 80rpx;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				font-size: $uni-font-size-base;

				.content-l {
					flex: 1;

					.title-class {
						color: $uni-text-color-grey;
					}
				}

				.content-r {
					flex: 1;
					text-align: right;

					.title-class {
						color: $uni-text-color-grey;
					}
				}
			}
		}
	}

	.jy-dataWrap {
		width: 100%;
		height: 380rpx;
		background-color: $uni-bg-color;
		margin-top: 20rpx;

		.search-wrap {
			width: 100%;
			height: 100rpx;
			padding: 0 10px;
			display: flex;
			justify-content: center;
			align-items: center;
			padding-top: 40rpx;

			.dropdown-wrap {
				width: 90%;
				flex: 5;
				// height: 80rpx;
				// border: 1px solid $uni-border-color;
				// border-radius: 10rpx;
				// margin-left: 5%;
				// text-align: left;
				// line-height: 80rpx;
				// box-shadow: 0 0 9px 3px #F2F2F2;
			}

			.search_cont {
				width: 90%;
				height: 80rpx;
				padding: 0 20rpx;
				flex: 5;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border: 1px solid $uni-border-color;
				border-radius: 10rpx;

			}

			.search {
				flex: 1;

				image {
					width: 50rpx;
					height: 50rpx;
					margin-left: 40rpx;
				}
			}
		}

		.dataView {
			width: 100%;
			height: 100rpx;
			padding-left: 5%;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			margin-top: 20rpx;

			.data-l {
				flex: 1;
				color: red;

				.data-l-wrap {
					margin-top: 20rpx;
					display: flex;
					height: 100rpx;
					align-items: center;

					.number-l {
						// font-size: $uni-font-size-lg;
						font-size: 44rpx;
						font-weight: 600;
					}

					.number-r {
						font-size: $uni-font-size-sm;
						margin-left: 20rpx;
					}
				}

			}

			.data-r {
				flex: 1;

				.right-wrap {
					margin-top: 20rpx;
					display: flex;
					height: 100rpx;
					align-items: center;

					.right-number {
						flex: 1;
						color: $uni-text-color-grey;
						margin-left: 10rpx;
					}
				}
			}
		}

		.acount-wrap {
			width: 90%;
			height: 100rpx;
			margin-left: 5%;
			display: flex;
			justify-content: center;
			align-items: center;
			margin-top: 20rpx;
			color: #FFFFFF;

			.zhangWrap {
				flex: 1;
				height: 100%;
				background-color: #ff4d59;
				text-align: center;
				border-radius: 10rpx;
			}

			.dieWrap {
				flex: 1;
				height: 100%;
				background-color: #3dbf61;
				text-align: center;
				margin-left: 20rpx;
				border-radius: 10rpx;
			}

			.pingWrap {
				flex: 1;
				height: 100%;
				background-color: #fda600;
				text-align: center;
				margin-left: 20rpx;
				border-radius: 10rpx;
			}

			.zhang-t {
				width: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
				margin-top: 10rpx;

				image {
					width: 40rpx;
					height: 40rpx;
				}

				font-size: $uni-font-size-lg;

				span {
					margin-left: 10rpx;
				}
			}

			.zhang-b {
				margin-top: 10rpx;
				font-size: $uni-font-size-sm;
			}
		}
	}

	.table-wrap {
		width: 100%;
		margin-top: 20rpx;
	}

	.noLoginWrap {
		width: 100%;
		height: 100vh;
		background-color: $uni-bg-color;

		.title-t {
			width: 100%;
			text-align: center;
			padding-top: 80rpx;
			// font-family:Georgia;
			// font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
			font-family: Georgia, 'Times New Roman', Times, serif;
			font-weight: 800;
			font-size: 106rpx;
		}

		.u-grid {
			margin-top: 200rpx;
			margin-bottom: 100rpx;
		}

		.grid-text {
			font-size: 28rpx;
			margin-top: 16rpx;
			color: $u-type-info;
		}

		.u-button {
			margin-top: 50rpx;
		}

		uni-button {
			margin: 40rpx;
		}

		.no-bottom {
			width: 100%;
			height: 50rpx;
			line-height: 50rpx;
			text-align: center;
			position: absolute;
			bottom: 30rpx;
			color: $uni-text-color-grey;
			font-size: $uni-font-size-sm;
		}
	}
</style>
